public function initObjects() : void {
	initLogging();
}



private function initLogging() : void{
	myTarget = new GivonTraceTarget();
	myTarget.filters=["Life*", "com.wcarmon.*"];
	//myTarget.filters=["*"]
	myTarget.level = LogEventLevel.ALL;	//ALL, DEBUG, INFO, WARN, ERROR
	Log.addTarget( myTarget );
}



/////////////////////////////////////////////
public function getPlayerString() : String { 
	var s : String = '';
	if( Capabilities.isDebugger ){
		s += 'Debugger Player version';
	}else{
		s += 'Normal Player version';
	}
	s += " ("+ Capabilities.version +")";		
	return s;
}




public function showDebugInfo() : void{
	log.info('\n\n\n------------- LIFE APP -------------');
	log.info( ''+new Date() );
	log.info( 'Player version: ' + Capabilities.version );
	log.info( 'Plugin OS: ' + Capabilities.os );

	if( Capabilities.isDebugger ){
		log.info('Debugger version of flash player');
	}else{
		log.info('Normal version of flash player');
	}
	log.info('Application.application.url = ' + Application.application.url );
	
	log.info( 'Build Time: ' + model.build_time );
	log.info( 'Player Version: ' + model.getPlayerString() );

	var s : String = Capabilities.screenResolutionX + " x " + Capabilities.screenResolutionY;
	s += ", " + Capabilities.screenDPI + "-dpi"; 

	log.info( 'Screen resolution: ' + s );

	var s77 : String = "MP3 Support=" + Capabilities.hasMP3;
	s77 += ", hasAudioEncoder=" + Capabilities.hasAudioEncoder;
	s77 += ", hasAudio=" + Capabilities.hasAudio;
	s77 += ", hasVideoEncoder=" + Capabilities.hasVideoEncoder;
	log.info( s77 );				
}




public function getIconClassByState( state_id :uint, mode:String='' ) : Class{
	switch( state_id ){
		case BlockVO.STATE_COLLECT:			return img_collect;
		case BlockVO.STATE_REFERENCE:		return img_ref;
		case BlockVO.STATE_CALENDAR:		return img_cal;
		case BlockVO.STATE_NEXT_ACTION:		
			if( mode == 'overdue' ){	
				return img_na_overdue; 
			}else{ 
				return img_na; 
			} 
		case BlockVO.STATE_WF:				
			if( mode == 'overdue' ){	
				return img_wf_overdue; 
			}else{ 
				return img_wf; 
			}
		case BlockVO.STATE_PROJECT_INDEX:	
			if( mode == 'overdue' ){	
				return img_proj_overdue; 
			}
			else{ 
				return img_proj; 
			}
		case BlockVO.STATE_UNCOMMITED_NEAR_FUTURE:	return img_unf;
		case BlockVO.STATE_UNCOMMITED_DISTANT_FUTURE: return img_udf;
		default:
			trace("[getIconClassByState] could not find icon for state_id=" + state_id);
			return null;	//???
	}
}





//////////////////////////////////////////////////////////////////
public static function getStateName( state_id : uint ) : String{
	switch( state_id ){
		case 0: return "-0-";
		case BlockVO.STATE_COLLECT : return "Collect";
		case BlockVO.STATE_REFERENCE : return 'Reference';
		case BlockVO.STATE_CALENDAR : return 'Calendar';
		case BlockVO.STATE_NEXT_ACTION : return 'Next Action';
		case BlockVO.STATE_WF : return 'Waiting For';
		case BlockVO.STATE_PROJECT_INDEX : return 'Project';
		case BlockVO.STATE_UNCOMMITED_NEAR_FUTURE : return 'Unc. Near Future';
		case BlockVO.STATE_UNCOMMITED_DISTANT_FUTURE : return 'Unc. Distant Future';
		//case STATE_TRASH : return 'Trash';
		default: return 'unknown ('+state_id+')';
	}
}



//////////////////////////////////////////////////////////////////
public function gotoScreen( screen : Number ) : void{
	if( currentScreen != screen ){
		prevScreen = currentScreen;
		currentScreen = screen;
	}
}




public static function showField( fieldName : String, state_id : uint ) : Boolean{
/*	unnecessary... I won't call show Field on these fields
	if( "id#content#cost#created#modified#projectIds#isComplete#isRejected#isPrivate#ref_code#ref_meta#url1#url2#state_id".indexOf(fieldName) != -1){
		return true;
	}
*/	
	switch( state_id ){
		case BlockVO.STATE_COLLECT:
			return true;	//shortcut!
		case BlockVO.STATE_REFERENCE:
			return -1 != "fileIds#ref_language".indexOf(fieldName);
		case BlockVO.STATE_CALENDAR:
			return -1 != "deadline#timeInHours".indexOf(fieldName);
		case BlockVO.STATE_NEXT_ACTION:
			return -1 != "contextIds#deadline#dependsOn#fileIds#importance#timeInHours".indexOf(fieldName);
		case BlockVO.STATE_WF :
			return -1 != "canDelegate#deadline#delegateTo#dependsOn#fileIds#outcome".indexOf(fieldName);
		case BlockVO.STATE_PROJECT_INDEX:
			return -1 != "canDelegate#deadline#delegateTo#dependsOn#fileIds#outcome#timeInHours#viewLevel_id".indexOf(fieldName);
		case BlockVO.STATE_UNCOMMITED_NEAR_FUTURE:
			return -1 != "canDelegate#deadline#delegateTo#dependsOn#fileIds#outcome#somedayLabel#timeInHours#viewLevel_id".indexOf(fieldName);
		case BlockVO.STATE_UNCOMMITED_DISTANT_FUTURE:
			return -1 != "canDelegate#delegateTo#dependsOn#fileIds#outcome#somedayLabel#timeInHours#viewLevel_id".indexOf(fieldName);
	}
	trace("{showField} this should never happen: state=" + state_id + ", fieldName=" + fieldName);
	return false;	
}
